package com.example.studentmanagement.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.example.studentmanagement.R;

public class Bottom_Bar extends LinearLayout{

        public LinearLayout bottomBar ;
        private Button studentBtn ;
        private Button courseBtn ;
        private Button personBtn ;
        public Bottom_Bar(Context context) {
            super(context);
            bottomView();
        }

        public Bottom_Bar(Context context, AttributeSet attrs) {
            super(context, attrs);
            bottomView();
        }
        private void bottomView() {
            View inflatedView = LayoutInflater.from(getContext()).inflate(R.layout.bottom_bar, this, true);
            // 使用inflatedView来查找子元素
            bottomBar = inflatedView.findViewById(R.id.bottom_bar);
            studentBtn = inflatedView.findViewById(R.id.studentlistBtn);
            courseBtn = inflatedView.findViewById(R.id.courseBtn);
            personBtn = inflatedView.findViewById(R.id.personalBtn);
        }
        public void setStudentBtnClickListener(OnClickListener listener){
            studentBtn.setOnClickListener(listener);
        }
        public void setCourseBtnClickListener(OnClickListener listener){
            courseBtn.setOnClickListener(listener);
        }
        public void setPersonBtnClickListener(OnClickListener listener){
            personBtn.setOnClickListener(listener);
        }
        public void setStudentBtnBackground(int res){
            studentBtn.setBackgroundColor(res);
        }
        public void setCourseBtnBackground(int res){
            courseBtn.setBackgroundColor(res);
        }
        public void setPersonBtnBackground(int res){
            personBtn.setBackgroundColor(res);
        }
    }


